package com.atstudent.gmall.product.controller;

import com.atstudent.gmall.common.result.Result;
import com.atstudent.gmall.common.result.ResultCodeEnum;
import com.atstudent.gmall.product.entity.BaseAttrValue;
import com.atstudent.gmall.product.service.BaseAttrValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 平台属性值
 * @Author 薛有朋
 * @CreatDate 2024/11/24 13:02
 **/
@RestController
@RequestMapping(value = "/admin/product")
public class BaseAttrValueController {

    @Autowired
    private BaseAttrValueService baseAttrValueService;

    /**
     * 根据平台属性id获取平台属性值
     * @Author 薛有朋
     * @Date 2024/11/24 13:03
     **/
    @GetMapping(value = "/getAttrValueList/{attrId}")
    public Result<List<BaseAttrValue>> findByAttrId(@PathVariable(value = "attrId") Long attrId){
        List<BaseAttrValue> baseAttrValueList = baseAttrValueService.findByAttrId(attrId);
        return Result.build(baseAttrValueList, ResultCodeEnum.SUCCESS);
    }
}
